package com.practice.book.controller;

import com.practice.book.service.UserService;
import jakarta.servlet.http.HttpSession;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: hp
 * Date: 2025-01-11
 * Time: 13:55
 */
@RestController
@Slf4j
@RequestMapping("/user")
public class UserController {
    @Autowired
    private UserService userService;
    @PostMapping("/login")
    public Boolean login(@RequestParam("name") String name, @RequestParam("password") String password, HttpSession session) {
        log.info("接收参数" + name);

        Boolean result = userService.checkUserNameAndPassword(name,password,session);
        log.info("用户登入结果: name:{}, 结果: {} ",name,result);
        return result;
    }


}
